#include "Lights.h"
//---------------------------------------------------------------------------------------------//
Light::Light(Graphics &graphics): m_graphics(graphics)
{
	ZeroMemory( &m_light, sizeof(D3DLIGHT9) );
	m_light.Diffuse.r  = 1.0f;
	m_light.Diffuse.g  = 1.0f;
	m_light.Diffuse.b  = 1.0f;
	m_light.Diffuse.a  = 1.0f;

	m_light.Range = 1000.0f;
}
//---------------------------------------------------------------------------------------------//
DirectionalLight::DirectionalLight(Graphics &graphics, const Vector3 &direction) : Light(graphics)
{
	m_light.Type = D3DLIGHT_DIRECTIONAL;
	m_light.Direction = direction;
}
//---------------------------------------------------------------------------------------------//
PointLight::PointLight(Graphics &graphics, const Vector3 &position) :  Light(graphics)
{
	m_light.Type = D3DLIGHT_POINT;
	m_light.Position = position;
}
//---------------------------------------------------------------------------------------------//
SpotLight::SpotLight(Graphics &graphics, const Vector3 &direction, const Vector3 &position) : Light(graphics)
{
	m_light.Type = D3DLIGHT_SPOT;
	m_light.Direction = direction;
	m_light.Position = position;

	m_light.Range = 1.0f;
	m_light.Theta = 0.5f;
	m_light.Phi = 1.0f;
	m_light.Falloff = 1.0f;
	m_light.Attenuation0 = 1.0f;
}
//  http://www.toymaker.info/Games/html/lighting.html
//	http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B9.aspx